﻿// Copyright (c)  MOKEYISH. All rights reserved.
// Licensed under the MIT License, See License.txt in the project root for license information.

using JetBrains.Annotations;

namespace NSQL.Expressions.Functions
{
    public class SubStringFunction : BaseExpression, ISubStringFunction
    {
        public IStringExpression Text { get; set; }
        public IIntegerExpression Position { get; set; }
        public IIntegerExpression Length { get; set; }

        public SubStringFunction(IValueExpression text, IIntegerExpression position, IIntegerExpression length = null)
        {
            Text = (IStringExpression) text;
            Position = position;
            Length = length;
        }
        
        public override T Accept<T>(IExpressionVisitor<T> visitor) => visitor.Visit(this);
    }
}